package jech913.util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class OracleJDBC {
	protected static String DRV="oracle.jdbc.OracleDriver";
	protected static String URL="jdbc:oracle:thin:@//112.216.253.122:1521/xe";
	protected static String USR="jech913";
	protected static String PWD="jech913";
	
	public static Connection OpenConn(){
		Connection conn = null;
		try{
			Class.forName(DRV);
			//db요청이 들어 올 때~ 연결 
			conn = DriverManager.getConnection(URL, USR, PWD);
		}catch(Exception ex){
			ex.printStackTrace();
		} 
		return conn;
	}
	public static void closeConn(Connection c, PreparedStatement p, ResultSet r){
		if(r!= null)try{r.close();}catch(Exception e){};
		if(p!= null)try{p.close();}catch(Exception e){};
		if(c!= null)try{c.close();}catch(Exception e){};		
	}
	
}
